﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Bouyei.Geo.GeoParsers.GeoJson
{
    public class FeatureCollection<T>
    {
        public string ToGeoJsonString(Feature<T, PointArray>[] features)
        {
            GeoJsonPoint<T, PointArray> point = new GeoJsonPoint<T, PointArray>(features);
            return point.ToString();
        }

        public string ToGeoJsonString(Feature<T, PointMArray>[] features)
        {
            GeoJsonMultiPoint<T, PointMArray> point = new GeoJsonMultiPoint<T, PointMArray>(features);
            return point.ToString();
        }

        public string ToGeoJsonString(Feature<T, LineArray>[] features)
        {
            GeoJsonLineString<T, LineArray> line = new GeoJsonLineString<T, LineArray>(features);
            return line.ToString();
        }

        public string ToGeoJsonString(Feature<T, LineMArray>[] features)
        {
            GeoJsonMultiLineString<T, LineMArray> line = new GeoJsonMultiLineString<T, LineMArray>(features);
            return line.ToString();
        }

        public string ToGeoJsonString(Feature<T, PolygonArray>[] features)
        {
            GeoJsonPolygon<T, PolygonArray> polygon = new GeoJsonPolygon<T, PolygonArray>(features);
            return polygon.ToString();
        }

        public string ToGeoJsonString(Feature<T, PolygonMArray>[] features)
        {
            GeoJsonMultiPolygon<T, PolygonMArray> polygon = new GeoJsonMultiPolygon<T, PolygonMArray>(features);
            return polygon.ToString();
        }

        public GeoJsonPoint<T, PointArray> FromGeoJsonPoint(string geoJson)
        {
            GeoJsonPoint<T, PointArray> g = new GeoJsonPoint<T, PointArray>();
            g.FromGeoJson(geoJson);
            return g;
        }

        public GeoJsonMultiPoint<T, PointMArray> FromGeoJsonMultiPoint(string geoJson)
        {
            GeoJsonMultiPoint<T, PointMArray> g = new GeoJsonMultiPoint<T, PointMArray>();
            g.FromGeoJson(geoJson);
            return g;
        }

        public GeoJsonLineString<T, LineArray> FromGeoJsonLineString(string geoJson)
        {
            GeoJsonLineString<T, LineArray> g = new GeoJsonLineString<T, LineArray>();
            g.FromGeoJson(geoJson);
            return g;
        }

        public GeoJsonMultiLineString<T, LineMArray> FromGeoJsonMultiLineString(string geoJson)
        {
            GeoJsonMultiLineString<T, LineMArray> g = new GeoJsonMultiLineString<T, LineMArray>();
            g.FromGeoJson(geoJson);
            return g;
        }

        public GeoJsonPolygon<T, PolygonArray> FromGeoJsonPolygon(string geoJson)
        {
            GeoJsonPolygon<T, PolygonArray> g = new GeoJsonPolygon<T, PolygonArray>();
            g.FromGeoJson(geoJson);
            return g;
        }

        public GeoJsonMultiPolygon<T, PolygonMArray> FromGeoJsonMultiPolygon(string geoJson)
        {
            GeoJsonMultiPolygon<T, PolygonMArray> g = new GeoJsonMultiPolygon<T, PolygonMArray>();
            g.FromGeoJson(geoJson);
            return g;
        }
    }
}
